package com.leilingmin.www.util;

import org.springframework.stereotype.Component;

@Component
public class ValidationUtils {
    // 验证手机号
    public static boolean validatePhoneNumber(String phoneNumber) {
        String regex = "^1[3456789]\\d{9}$";
        return phoneNumber.matches(regex);
    }

    // 验证邮箱
    public static boolean validateEmail(String email) {
        String regex = "^[\\w!#$%&'*+/=?`{|}~^-]+(?:\\.[\\w!#$%&'*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$";
        return email.matches(regex);
    }
}
